import request from '../utils/request.js'

export function createOrder(data) {
  return request({
    url: '/api/order/create',
    method: 'POST',
    data
  })
}

export function getMyOrders() {
  return request({
    url: '/api/order/list',
    method: 'GET'
  })
}

export function getOrderDetail(id) {
  return request({
    url: `/api/order/${id}`,
    method: 'GET'
  })
}

export function payOrder(id) {
  return request({
    url: `/api/order/pay/${id}`,
    method: 'POST'
  })
}

export function cancelOrder(id) {
  return request({
    url: `/api/order/cancel/${id}`,
    method: 'POST'
  })
}
